<!--
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2022-08-15 16:45:26
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2022-12-22 13:07:45
 * @FilePath: \grazlink20\uc_sys\src\components\Lee\Search\src\LeeSearch.vue
 * Copyright (c) 2022 by 李天惊 uf_lee@163.com, All Rights Reserved. 
-->
<script setup lang="ts">
import { PropType } from 'vue'
import { ElButton } from 'element-plus'
import { Form } from '@/components/Form'
import { propTypes } from '@/utils/propTypes'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n()
const props = defineProps({
  // 生成Form的布局结构数组
  schema: {
    type: Array as PropType<FormSchema[]>,
    default: () => []
  },
  showSearch: propTypes.bool.def(true),
  showReset: propTypes.bool.def(true),
  // 是否显示伸缩
  expand: propTypes.bool.def(false)
})

const search = async () => {
  console.log('search')
}

const reset = async () => {
  console.log('reset')
}

const setVisible = async () => {
  console.log('setVisible')
}
</script>

<template>
  <div>
    <Form :schema="props.schema" :is-col="false" hide-required-asterisk inline />
    <template>
      444
      <div>
        333
        <ElButton v-if="showSearch" type="primary" @click="search">
          <Icon icon="ep:search" class="mr-5px" />
          {{ t('common.query') }}
        </ElButton>
        <ElButton v-if="showReset" @click="reset">
          <Icon icon="ep:refresh-right" class="mr-5px" />
          {{ t('common.reset') }}
        </ElButton>
        <ElButton v-if="expand" text @click="setVisible">
          {{ t('common.shrink') }}
          {{ t('common.expand') }}
          <Icon :icon="'ant-design:up-outlined'" />
          <Icon :icon="'ant-design:down-outlined'" />
        </ElButton>
      </div>
    </template>
  </div>
</template>
